// pages/index/messagecenter/systemnews/systemnews.js
import { axios } from '../../../utils/ajax.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    data: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    let { userid = '', token = '' } = wx.getStorageSync('userinfo')
    console.log(userid, token)
    if (userid) {
      axios({
        url: '/message/systemMsgCount',
        data: {
          user_id: userid
        }
      }).then((res) => {
        console.log(res.data)
        this.setData({
          data: res.data.data
        })
      })
    }
  },
  //去活动消息
  goactnews () {
    let url = 'https://m.ayouxing.com/aiyouyx_m.php/Aiyouyx/Msg/act/msg_type/2'  //正式服地址:'https://m.ayouxing.com/aiyouyx_m.php/Aiyouyx/Msg/act/msg_type/2'
    wx.navigateTo({ 
      url: `../../webview/webview?linkId=${url}&type=1`,
    })
  },
  //去交易消息
  godealnews () {
    wx.navigateTo({
      url: './dealnews/dealnews',
    })
  },
  //去开售提醒
  gosellremind() {
    let url = 'https://m.ayouxing.com/aiyouyx_m.php/Aiyouyx/Msg/remind'    //正式服地址:'https://m.ayouxing.com/aiyouyx_m.php/Aiyouyx/Msg/remind'
    wx.navigateTo({
      url: `../../webview/webview?linkId=${url}&type=1`,
    })
  },
  //
  //去系统消息
  gosystemnews() {
    // let url = 'https://m.ayouxing.com/aiyouyx_m.php/Aiyouyx/Msg/system/msg_type/1' //正式服地址:'https://m.ayouxing.com/aiyouyx_m.php/Aiyouyx/Msg/system/msg_type/1'
    // wx.navigateTo({
    //   url: `../../webview/webview?linkId=${url}&type=1`,
    // })
    wx.navigateTo({
      url: 'systemnews/systemnews',
    })
  }
})